//
//  ZSPictureCell.swift
//  ZSWeibo
//
//  Created by zsj1992 on 16/4/14.
//  Copyright © 2016年 ichange. All rights reserved.
//

import UIKit
import SDWebImage
import SnapKit


class ZSPictureCell: UICollectionViewCell {
    
    
    //cell里面带一个picture模型,用来加载图片
    var picture:ZSPicture?{
    
        didSet{
        
            
        imageView?.sd_setImageWithURL(NSURL(string: (picture?.thumbnail_pic)!))
           
//            print((picture?.thumbnail_pic)!)
            
        }
    }
    
    //懒加载一个图片框
   lazy var imageView:UIImageView? = UIImageView()
    
    
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
    addSubview(imageView!)
    
        
    imageView?.contentMode = .ScaleAspectFill
    imageView?.clipsToBounds = true
    imageView?.snp_makeConstraints(closure: { (make) -> Void in
        
    
        
        make.center.equalTo(self.contentView)
        
        make.size.equalTo(self.contentView.snp_size)
        
    })

    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    
}
